import argparse
from web_server_function.UserServer import user_server
from web_server_function.ServerUtils import server_utils
from utils.ReadUtil import read_util


# if __name__ == '__main__':
#     # 超管登录
#     server_utils.login_background("15917614074", "123456")
#     # 获取用户id
#     user_id = user_server.get_user_info_id("13900000014")
#     print(user_id)
#     # 执行重置密码操作
#     reset_result = user_server.reset_user_password(user_id)
#     print(reset_result)


def main(user_phone_number):
    # 超管登录
    server_utils.login_background(read_util.read_data()['后台账号密码']['超管账号'],
                                  read_util.read_data()['后台账号密码']['超管密码'])
    # 通过手机号查询获取用户id
    user_id = user_server.get_user_info_id(user_phone_number)
    print(f"用户id为{user_id}")
    # 执行重置密码操作
    reset_result = user_server.reset_user_password(user_id)
    print(reset_result)


if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='执行用户密码重置操作')
    parser.add_argument('user_phone_number', type=str, help='用户手机号')
    args = parser.parse_args()

    main(args.user_phone_number)
